package com.kehutong.charge.util.enums;

import org.coraframework.util.HashID;

/**
 * @program: kht
 * @description: 公用枚举
 * @author: joneron
 * @create: 2021/7/21
 **/
public enum CommonEnum implements HashID {

    COM_PAY_ONLINE("1","线上支付"),
    COM_PAY_OFFLINE("2","线下支付"),
    COM_PAY_WECHAT("3","微信支付"),
    COM_PAY_ALIPAY("4","支付宝支付"),
    COM_PAY_BANK("5","银行卡支付"),
    COM_PAY_CASH("6","现金收款"),
    COM_PAY_BALANCE("7","余额收款"),
    COM_PAY_NOT("8","未支付"),

    /** 订单支付来源 */
    COM_PAY_WXPAY_QR("wxpay_qr","二维码"),
    COM_PAY_WXPAY_WAP("wxpay_wap","公众号"),
    COM_PAY_WXPAY_MP("wxpay_mp","小程序"),
    COM_PAY_WXPAY_WEB("wxpay_web","WEB"),
    COM_PAY_WXPAY_QW("wxpay_qw","企业微信"),
    COM_PAY_WXPAY_PAP("pap","代扣"),

    /** 调用支付入口 */
    COM_PAY_ROUTINE("ROUTINE","常规收款"),
    COM_PAY_INTERIM("INTERIM","临时收款"),
    ;

    private final String id;
    private final String desc;

    private CommonEnum(String id, String desc) {
        this.id = id;
        this.desc = desc;
    }

    public static CommonEnum getById(String id){
        for (CommonEnum anEnum : CommonEnum.values()) {
            if(anEnum.id.equals(id)){
                return anEnum;
            }
        }
        return null;
    }

    @Override
    public String getId() {
        return id;
    }


    @Override
    public String getDesc() {
        return desc;
    }
}
